package com.crm.system.controller.activityManager;

import com.crm.common.model.DataResponse;
import com.crm.common.model.DhResponse;
import com.crm.common.model.Enum.ResponseCodeEnum;
import com.crm.system.service.activityManager.CustomerGiftActivityRelationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

/**
 * @author luojie
 * @date 2021/3/1 14:53
 */
@RestController
@RequestMapping("/customerGiftActivityRelation")
@Slf4j
public class CustomerGiftActivityRelationController {

    @Autowired
    private CustomerGiftActivityRelationService customerGiftActivityRelationService;

    /**
     * 根据赠品活动id查询赠品下拉框列表(包含是否选中状态)
     * @return
     */
    @GetMapping("/selectGiftDropDownCheckedListByGiftActivityId")
    public DataResponse selectGiftDropDownCheckedListByGiftActivityId(@RequestParam String giftActivityId){
        try{
            List<HashMap> hashMapList = customerGiftActivityRelationService.selectGiftDropDownCheckedListByGiftActivityId(giftActivityId);
            return new DhResponse(ResponseCodeEnum.OK.getResponseCode(),hashMapList);
        }catch(Exception e){
            log.error("customerGiftActivityRelation selectGiftDropDownCheckedListByGiftActivityId error:", e);
            return new DhResponse(ResponseCodeEnum.SERVICE_ERROR.getResponseCode());
        }
    }

}
